<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h1> 登陆页面 </h1>

  账号：<input type="text" class="user">
  密码： <input type="text" class="pwd">
  <button class='submit'>提交</button>

  <script src="js/axios.js"></script>
  <script>
    const user = document.querySelector('.user')
    const pwd = document.querySelector('.pwd')
    const submit = document.querySelector('.submit')
    submit.onclick = function () {
      axios.post('/api/login', {
        user: user.value.trim(),
        pwd: pwd.value.trim()
      }).then(res => {
        console.log(res.data, 'res')
      })
    }


  </script>

</body>

</html>